<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRightsEntityProductsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('rights_entity_products', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->bigInteger('entity_id')->index()->comment('实物ID');
            $table->bigInteger('product_id')->index()->comment('产品ID');
            $table->unique(['entity_id', 'product_id']);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('rights_entity_products');
    }
}
